// 频道相关的接口
import axios from '@/utils/request'

/**
 * 获取用户频道
 * @returns
 */
export const getChannels = () => {
  return axios({
    url: '/v1_0/user/channels'
  })
}

/**
 *获取所有频道列表
 * @param {*} channels {[频道id]}
 * @returns
 */
export const getAllChannels = () => {
  return axios({
    url: '/v1_0/channels'
    // data: {
    //   channels
    // }
  })
}

/**
 * 设置用户的频道（部分覆盖）
 * @param {*} channels [频道的id]
 * @returns
 */
export const setUserChannel = channels => {
  return axios({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels
    }
  })
}

/**
 * 删除指定用户频道
 * @param {*} target 用户频道id
 * @returns
 */
export const delUserChannel = target => {
  return axios({
    method: 'DELETE',
    url: `/v1_0/user/channels/${target}`
  })
}
